<?php
$taskId = $_GET['id'] ?? null;
if (empty($taskId)){
    echo "任务id错误";
    exit();
}
$taskStatus = $_GET['status'] ?? null;
if ($taskStatus != 3){
    echo "任务状态错误";
    exit();
}

$dsn = "sqlsrv:Server=localhost;Database=Task";
$db = new PDO($dsn, "sa", "123456");

$updateSsql = "update Task set TaskStatus='{$taskStatus}' where TaskId=".$taskId;
$result = $db ->exec($updateSsql);
if ($result){
    echo "任务修改已完成成功<br/>";
    echo "<a href='task_detail.php?id=" . $taskId . "'>返回详情页面</a>";
} else{
    echo "任务修改已完成失败<br/>";
    echo "<a href='javascript:history.go(-1)'>返回上一页</a>";
}